package com.bdqn.ch05.SL;

import com.bdqn.ch05.SL.mapper.Ink;

import java.awt.*;

/**
 * ColorInk  彩色墨盒实现类
 *
 * @aurhor Administrator  whs
 * @since 2024/7/10
 */
public class ColorInk implements Ink {
    /**
     * 打印彩色文字
     *
     * @param red   红色值
     * @param green 绿色值
     * @param blue  蓝色值
     * @return 返回打印采用的颜色
     */
    @Override
    public String getColor(int red, int green, int blue) {
        Color color = new Color(red, green, blue);
        return "#"+Integer.toHexString(color.getRGB()).substring(2);
    }
}
